package com.hzhr.iot.statis.convertor;

import com.hzhr.iot.statis.convertor.custom.*;
import com.hzhr.iot.core.util.HzhrTypeUtil;
import com.hzhr.iot.core.util.HzhrJsonUtil;
import java.util.Map;
import com.hzhr.iot.statis.model.gasUserDailyGasConsume.GasUserDailyGasConsumeModel;
import com.hzhr.iot.statis.entity.GasUserDailyGasConsumeEntity;
import com.hzhr.iot.statis.entity.ext.GasUserDailyGasConsumeEntityExt;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import com.hzhr.iot.statis.model.gasUserDailyGasConsume.GasUserDailyGasConsumeModel;
import com.hzhr.iot.statis.model.gasUserDailyGasConsume.GasUserDailyGasConsumeGetModel;
import com.hzhr.iot.statis.queryModel.custom.GasUserDailyGasConsumeCustomQueryModel;

@Component
public class GasUserDailyGasConsumeConvertor {
    @Autowired
    DeptDailyGasConsumeCustomConvertor deptDailyGasConsumeCustomConvertor;
    @Autowired
    DeptMonthlyGasConsumeCustomConvertor deptMonthlyGasConsumeCustomConvertor;
    @Autowired
    DeviceCollectDeviceCustomConvertor deviceCollectDeviceCustomConvertor;
    @Autowired
    DeviceDailyGasConsumeCustomConvertor deviceDailyGasConsumeCustomConvertor;
    @Autowired
    DeviceDataExceptionCustomConvertor deviceDataExceptionCustomConvertor;
    @Autowired
    DeviceHourlyGasConsumeCustomConvertor deviceHourlyGasConsumeCustomConvertor;
    @Autowired
    DeviceIotDeviceCustomConvertor deviceIotDeviceCustomConvertor;
    @Autowired
    DeviceMonthlyGasConsumeCustomConvertor deviceMonthlyGasConsumeCustomConvertor;
    @Autowired
    GasUserMonthlyGasConsumeCustomConvertor gasUserMonthlyGasConsumeCustomConvertor;
    @Autowired
    OptionsCustomConvertor optionsCustomConvertor;

    public GasUserDailyGasConsumeEntity gasUserDailyGasConsumeModel2entity(GasUserDailyGasConsumeModel in) {
        //未转换字段: id 
        if (in == null) return null;
        GasUserDailyGasConsumeEntity result = new GasUserDailyGasConsumeEntity();

        result.setGasUserId(HzhrTypeUtil.integer2integer(in.getGasUserId()));
        result.setGasUserType(HzhrTypeUtil.string2string(in.getGasUserType()));
        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.long2date(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public GasUserDailyGasConsumeEntity gasUserDailyGasConsumeModel2entity(GasUserDailyGasConsumeModel in, GasUserDailyGasConsumeEntity ori) {
        //未转换字段: id 
        if (in == null) return null;
        GasUserDailyGasConsumeEntity result = ori;

        result.setGasUserId(HzhrTypeUtil.integer2integer(in.getGasUserId()));
        result.setGasUserType(HzhrTypeUtil.string2string(in.getGasUserType()));
        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.long2date(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<GasUserDailyGasConsumeEntity> gasUserDailyGasConsumeModelList2entityList(List<GasUserDailyGasConsumeModel> in) {
        if (in == null) return null;
        List<GasUserDailyGasConsumeEntity> result = new ArrayList<>();
        for (GasUserDailyGasConsumeModel item : in) {
            result.add(gasUserDailyGasConsumeModel2entity(item));
        }
        return result;
    }
    public GasUserDailyGasConsumeModel entity2gasUserDailyGasConsumeModel(GasUserDailyGasConsumeEntity in) {
        //未转换字段: 
        if (in == null) return null;
        GasUserDailyGasConsumeModel result = new GasUserDailyGasConsumeModel();

        result.setGasUserId(HzhrTypeUtil.integer2integer(in.getGasUserId()));
        result.setGasUserType(HzhrTypeUtil.string2string(in.getGasUserType()));
        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.date2long(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<GasUserDailyGasConsumeModel> entityList2gasUserDailyGasConsumeModelList(List<GasUserDailyGasConsumeEntity> in) {
        if (in == null) return null;
        List<GasUserDailyGasConsumeModel> result = new ArrayList<>();
        for (GasUserDailyGasConsumeEntity item : in) {
            result.add(entity2gasUserDailyGasConsumeModel(item));
        }
        return result;
    }
    public GasUserDailyGasConsumeModel ext2gasUserDailyGasConsumeModel(GasUserDailyGasConsumeEntityExt in) {
        //未转换字段: 
        if (in == null) return null;
        GasUserDailyGasConsumeModel result = new GasUserDailyGasConsumeModel();

        result.setGasUserId(HzhrTypeUtil.integer2integer(in.getGasUserId()));
        result.setGasUserType(HzhrTypeUtil.string2string(in.getGasUserType()));
        result.setDeptId(HzhrTypeUtil.integer2integer(in.getDeptId()));
        result.setCompanyId(HzhrTypeUtil.integer2integer(in.getCompanyId()));
        result.setData(HzhrTypeUtil.double2double(in.getData()));
        result.setDate(HzhrTypeUtil.date2long(in.getDate()));
        result.setDataStatus(HzhrTypeUtil.string2string(in.getDataStatus()));
        return result;
    }
    public List<GasUserDailyGasConsumeModel> extList2gasUserDailyGasConsumeModelList(List<GasUserDailyGasConsumeEntityExt> in) {
        if (in == null) return null;
        List<GasUserDailyGasConsumeModel> result = new ArrayList<>();
        for (GasUserDailyGasConsumeEntityExt item : in) {
            result.add(ext2gasUserDailyGasConsumeModel(item));
        }
        return result;
    }
    public GasUserDailyGasConsumeGetModel extList2gasUserDailyGasConsumeGetModel(List<GasUserDailyGasConsumeEntityExt> extList, Integer total, Integer changeCount, Map<String, Object> query) {
        List<GasUserDailyGasConsumeModel> modelList = extList2gasUserDailyGasConsumeModelList(extList);
        if (modelList == null) {
            GasUserDailyGasConsumeGetModel result = new GasUserDailyGasConsumeGetModel();
            result.setTotal(total);
            result.setChangeCount(changeCount);
            return result;
        }

         String _show = HzhrTypeUtil.object2string(query.get("_show"));


        GasUserDailyGasConsumeGetModel result = new GasUserDailyGasConsumeGetModel();
        if ("one".equals(_show)) {
            if (modelList.size() > 0) {
                result.setModel(modelList.get(0));
            }
         }
        if ("list".equals(_show)) {
            result.setModelList(modelList);
        }
        result.setTotal(total);
        result.setChangeCount(changeCount);
        return result;
    }
    public GasUserDailyGasConsumeGetModel entity2gasUserDailyGasConsumeGetModel(GasUserDailyGasConsumeEntity entity, Integer total, Integer changeCount, Map<String, Object> query) {
        List<GasUserDailyGasConsumeEntityExt> extList = new ArrayList<>();
        if (entity == null) return extList2gasUserDailyGasConsumeGetModel(extList, total, changeCount, query);
        extList.add(HzhrJsonUtil.convertObjectType(entity, GasUserDailyGasConsumeEntityExt.class));
        return extList2gasUserDailyGasConsumeGetModel(extList, total, changeCount, query);
     }
    public GasUserDailyGasConsumeCustomQueryModel gasUserDailyGasConsumeService_query2queryModel(Map<String, Object> query) {
        GasUserDailyGasConsumeCustomQueryModel queryModel = new GasUserDailyGasConsumeCustomQueryModel();

        Integer _equal_gasUserId = HzhrTypeUtil.object2integer(query.get("_equal_gasUserId"));
        if (_equal_gasUserId != null) {
            queryModel.setEqual_gasUserId(_equal_gasUserId);
         }

        Integer _equal_deptId = HzhrTypeUtil.object2integer(query.get("_equal_deptId"));
        if (_equal_deptId != null) {
            queryModel.setEqual_deptId(_equal_deptId);
         }

        Integer _equal_companyId = HzhrTypeUtil.object2integer(query.get("_equal_companyId"));
        if (_equal_companyId != null) {
            queryModel.setEqual_companyId(_equal_companyId);
         }

        String _equal_gasUserType = HzhrTypeUtil.object2string(query.get("_equal_gasUserType"));
        if (_equal_gasUserType != null) {
            queryModel.setEqual_gasUserType(_equal_gasUserType);
         }

        Date _greaterthan_date = HzhrTypeUtil.object2date(query.get("_greaterthan_date"));
        if (_greaterthan_date != null) {
            queryModel.setGreaterthan_date(_greaterthan_date);
         }

        Date _greaterthanorequal_date = HzhrTypeUtil.object2date(query.get("_greaterthanorequal_date"));
        if (_greaterthanorequal_date != null) {
            queryModel.setGreaterthanorequal_date(_greaterthanorequal_date);
         }

        Date _lessthan_date = HzhrTypeUtil.object2date(query.get("_lessthan_date"));
        if (_lessthan_date != null) {
            queryModel.setLessthan_date(_lessthan_date);
         }

        Date _lessthanorequal_date = HzhrTypeUtil.object2date(query.get("_lessthanorequal_date"));
        if (_lessthanorequal_date != null) {
            queryModel.setLessthanorequal_date(_lessthanorequal_date);
         }

        String _orderBy_date = HzhrTypeUtil.object2string(query.get("_orderBy_date"));
        if (_orderBy_date != null) {
            queryModel.setOrderBy_date(_orderBy_date);
         }

        String _orderBy_data = HzhrTypeUtil.object2string(query.get("_orderBy_data"));
        if (_orderBy_data != null) {
            queryModel.setOrderBy_data(_orderBy_data);
         }

        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);
        queryModel.setShow(true);

        Integer page = HzhrTypeUtil.object2integer(query.get("_page"));
        Integer count = HzhrTypeUtil.object2integer(query.get("_count"));
        queryModel.setPage(page, count);

        return queryModel;
    }

}

